package com.framework.loippi.controller.api;

import com.framework.loippi.api.utils.ApiUtils;
import com.framework.loippi.service.DepartmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * API - 获取所有科室信息
 *
 * @author gx
 * @version 2.0
 */
@Controller("apiDepartmentController")
@RequestMapping(value = "/api/department")
@Api(tags = {"科室信息"})
public class DepartmentController extends ApiBaseController {

    @Resource
    DepartmentService departmentService;

    @RequestMapping(value = "/getAllDepart.json", method = RequestMethod.POST, produces="application/json;charset=UTF-8")
    @ApiOperation(value = "获取所有科室信息", notes = "{}")
    public @ResponseBody
    String getAllDepart(HttpServletRequest request, HttpServletResponse response) {
        List list = departmentService.findAll();
        System.out.println(list);
        return ApiUtils.success(departmentService.findAll());
    }
}
